<link href="/public/admin/css/uploadwxb.css" rel="stylesheet">
<script src="/public/common/ajaxfileupload.js"></script>
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox-content">
                <div class="row">
                    <form action="<?=url('tongcheng.info/create')?>" id="form-create" method="post"
                          class="form-horizontal" role="form">

                        <div class="form-group">
                            <label class="col-sm-3 control-label no-padding-right"><span
                                    class="c-red">*</span>会员：</label>
                            <div class="col-sm-9">
                                <input id="username" type="text" name="username" value=""
                                       placeholder="请单击选择会员 如果选择会员 则为 系统发布：" class="form-control"/>
                                <input type="hidden" value="" name="user_id" id="user_id">
                                <button id="show-btn1" style="display: none" type="button" mini="load" w="95%" h="95%"
                                        href="<?=url('miniapp/user.user/select')?>" class="btn btn-w-m btn-info">选择会员
                                </button>
                                <script>
                                    $("#username").focus(function () {
                                        $("#show-btn1").click();
                                    })

                                    function seleUser(user_name, user_id) {
                                        layer.closeAll();
                                        layer.msg('操作成功！');
                                        if (user_id == 0) {
                                            user_name = "系统发布";
                                        }
                                        $("#username").val(user_name);
                                        $("#user_id").val(user_id);
                                    }
                                </script>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label no-padding-right"><span
                                    class="c-red">*</span>分类：</label>
                            <div class="col-sm-9">
                                <select class="form-control m-b" name="category_id" id="category_id">
                                    <option value="0">请选择</option>
                                    <?php foreach($cate as $val) { ?>
                                    <option value="<?=$val->category_id?>"><?=$val->name?></option>
                                    <?php } ?>
                                </select>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label no-padding-right"><span
                                    class="c-red">*</span>内容：</label>
                            <div class="col-sm-9">
                                <textarea name="info" placeholder="说点什么...最少输入10个字符" id="info" cols="50" rows="10"
                                          class="form-control"><?=isset($detail->info)?$detail->info:''?></textarea>

                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label no-padding-right"><span
                                    class="c-red">*</span>图片：</label>
                            <div class="col-sm-9">
                                <div style="" class="photolist">
                                    <div data-type="0" class="content jq_photolist">
                                        <div class="addimg">
                                            <img onclick="$('#file').click();" src="/public/admin/img/add_img.png"/>
                                            <input type="file" name="file" id="file" style="display:none;"/>
                                            <div style=" margin-top: 10px; text-align: center;font-size: 14px; ">添加新图片
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label no-padding-right"><span
                                    class="c-red">*</span>排序：</label>
                            <div class="col-sm-9">
                                <input type="text" value="<?=isset($detail->orderby)?$detail->orderby:''?>"
                                       placeholder="" id="orderby" name="orderby" class="form-control"/>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label no-padding-right"><span
                                    class="c-red">*</span>联系方式：</label>
                            <div class="col-sm-9">
                                <input type="text" value="<?=isset($detail->tel)?$detail->tel:''?>" placeholder=""
                                       id="tel" name="tel" class="form-control"/>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label"><span class="c-red">*</span>置顶过期时间：</label>
                            <div class="col-sm-9">
                                <input value="<?=isset($detail->expire_time)?date('Y-m-d H:i:s',$detail->expire_time):''?>"
                                       placeholder="不置顶请留空 或者 置顶结束日期 大于当前时间" name="expire_time" id="expire_time"
                                       class="laydate-icon form-control layer-date">

                            </div>
                        </div>
                        <script>
                            laydate({
                                elem: '#expire_time',
                                event: 'focus',
                                format: 'YYYY-MM-DD hh:mm:ss',
                                istime: true
                            });
                        </script>
                        <div class="form-group">
                            <label class="col-sm-3 control-label no-padding-right"><span
                                    class="c-red">*</span>经度纬度：</label>
                            <div class="col-sm-3" style="margin-right: 0; padding-right: 0;">
                                <input type="text" readonly style="background-color: transparent;" class="form-control"
                                       value="<?=isset($detail->lat)?$detail->lat:'';?>" placeholder="" id="lat"
                                       name="lat"/>
                            </div>
                            <div class="col-sm-1" style="margin: 0;padding: 0;width: 1rem; line-height: 3rem">--</div>
                            <div class="col-sm-3" style="margin-left: 0; padding-left: 0;">
                                <input type="text" readonly style="background-color: transparent;" class="form-control"
                                       value="<?=isset($detail->lng)?$detail->lng:'';?>" placeholder="" id="lng"
                                       name="lng"/>
                            </div>
                            <div class="col-sm-2">
                                <button type="button" mini="load" w="1000px" h="800px"
                                        href="<?=url('index/map',['callback'=>'showLatLng']);?>?lat=<?=isset($detail->lat)?$detail->lat:'0';?>&lng=<?=isset($detail->lng)?$detail->lng:'0';?>"
                                        class="btn btn-w-m btn-info">选择地址
                                </button>
                            </div>
                            <script>
                                function showLatLng(lat, lng, addr) {
                                    layer.closeAll();
                                    layer.msg('选取经纬度成功！');
                                    $("#lat").val(lat);
                                    $("#lng").val(lng);
                                    $("#address").val(addr);
                                }
                            </script>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label no-padding-right"><span
                                    class="c-red">*</span>地址：</label>
                            <div class="col-sm-9">
                                <input type="text" value="<?=isset($detail->address)?$detail->address:''?>"
                                       placeholder="" id="address" name="address" class="form-control"/>
                            </div>
                        </div>
                        <div class="clearfix form-actions">
                            <div class="col-md-offset-3 col-md-9">
                                <button mini="submit" for="form-create" class="btn btn-info" type="button">
                                    <i class="ace-icon fa fa-check bigger-110"></i>
                                    保存
                                </button>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
<script id="imgitemtpl" type="text/html">
    <div class="imgitem">
        <input type="hidden" name="imgs[]" value="{{d.img}}">
        <img src="<?php echo IMG_URL;?>{{d.img}}"/>
        <div class="action">
            <button type="button" class="jq_delete_imgitem btn btn-outline btn-danger">删除</button>
        </div>
    </div>
</script>
<script>
    var day = '<?=date("Y-m-d",time());?>';
    var imgurl = '<?php echo IMG_URL;?>';
    var uploadUrl = '<?=url("upload.upload/index",["mdl"=>"toutiao_photo"])?>';
</script>
<script src="/public/admin/js/wxbupload.js"></script>